/**
 * @public  公用
 */
import Vue from 'vue';
import Router from 'vue-router';

/* layout */
import Layout from '../views/layout/Layout';

/* logiLayout */
// const logiLayout = resolve => require(['../views/layout/logiLayout'], resolve);

/**
 * @desc 所有子栏目集合
 * @default 手动编译-_-
 * @description 手动放开所在栏目的编译，上包时放开所有注释
 */
export { homeRouterMap }
from './homeRouterMap'; // 首页
export { userManageRouterMap }
from './userManageRouterMap'; // 用户
export { schoolAffairRouterMap }
from './schoolAffairRouterMap'; // 校务
export { fundRouterMap }
from './fundRouterMap'; // 资金
export { operationRouterMap }
from './operationRouterMap'; // 运营
export { teachingRouterMap }
from './teachingRouterMap'; // 教学
export { systemRouterMap }
from './systemRouterMap'; // 系统


/* Introduction */
// const Introduction = resolve => require(['../views/introduction/index'], resolve);

/* error page */
const Err404 = resolve => require(['../views/error/404'], resolve);
const Err401 = resolve => require(['../views/error/401'], resolve);
const error = resolve => require(['../views/error/serverMaintenance'], resolve);

/* error log */
// const ErrorLog = resolve => require(['../views/errlog/index'], resolve);

/* theme  */
// const Theme = resolve => require(['../views/theme/index'], resolve);


// 学校配置
// const schoolConfigure = resolve => require(['../views/schoolConfiguration/schoolConfigure'], resolve);

// 修改密码
const modifyPass = resolve => require(['../views/userManage/modifyPass'], resolve);

Vue.use(Router);


/**
 * icon : the icon show in the sidebar
 * hidden : if hidden:true will not show in the sidebar
 * redirect : if redirect:noredirect will not redirct in the levelbar
 * noDropdown : if noDropdown:true will not has submenu
 * meta : { role: ['admin'] }  will control the page role
 **/

/* login */
import Login from '../views/login/';
const authRedirect = resolve => require(['../views/login/authredirect'], resolve);
const sendPWD = resolve => require(['../views/login/sendpwd'], resolve);
const reset = resolve => require(['../views/login/reset'], resolve);

export const constantRouterMap = [
    { path: '/login', component: Login, hidden: true },
    { path: '/authredirect', component: authRedirect, hidden: true },
    { path: '/sendpwd', component: sendPWD, hidden: true },
    { path: '/reset', component: reset, hidden: true },
    { path: '/error', component: error, hidden: true },
    {
        path: '/userManage/modifyPass',
        name: '修改密码',
        hidden: true,
        component: modifyPass
    },
    {
        path: '/404',
        component: Layout,
        redirect: '/404/index',
        hidden: true,
        children: [
            { path: 'index', component: Err404 }
        ]
    },
    { path: '/401', component: Err401, hidden: true }
]

export default new Router({
    // mode: 'history', //后端支持可开
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap
});
